package flink.datastream;

import flink.model.Order;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.junit.Test;

import java.util.Arrays;

/**
 * @author binarylei
 * @version 2019-11-30
 */
public class WindowDataStreamTest {

    @Test
    public void test() {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<Order> ds1 = env.fromCollection(Arrays.asList(
                new Order(1L, "order1"),
                new Order(2L, "order2")));

        ds1.keyBy(0).timeWindow(Time.seconds(5));
    }
}
